{include file='include/headerFile'/}
{include file='include/header'/}
{include file='include/banner'/}
{empty name="bannerList"}
<div class="fenyebannerkong"></div>
{/empty}
<main>

    {include file='include/crumbs'/}
    {volist name="pagePartList" id="pagePart"}

    <!-- 发展历程 -->
    {if $pagePart.name == 'history' }

    <section>
        <div class="about2-s1-mid">
            <div class="about2-s1-kuang w1600">
                <p class="products-mid-bt">
                    Our Heritage
                </p>
                <p class="mater-s1-title">

                    A legacy of trust and reliability built over <br/><b>six decades</b> of industrial leadership.
                </p>
                <div class="fzlcswiper-mid">
                    <div class="swiper mySwiper2  fzlcxqswiper">
                        <div class="swiper-wrapper">

                            {volist name='developmentHistoryList' id='vo'}
                            <div class="swiper-slide">
                                <div class="fzlc-mid">
                                    <div class="fzlc-left">
                                        <p class="fzlc-math">
                                            {$vo.title}
                                        </p>
                                        <p class="fzlc-nr">
                                            {$vo.content}
                                        </p>
                                    </div>
                                    <div class="fzlc-right">
                                        <img src="{$vo.cover_image_url}" alt="{$systemInfo.title}" title=""/>
                                    </div>
                                </div>
                            </div>
                            {/volist}


                        </div><!--<div class="swiper-button-next"></div><div class="swiper-button-prev"></div>-->
                    </div>
                    <div thumbsslider="" class="swiper mySwiper fzlcnfswiper">
                        <div class="swiper-wrapper">
                            {volist name='developmentHistoryList' id='vo'}
                            <div class="swiper-slide">
                                <div class="yuan-kuang">
                                    <p class="yuan"></p>
                                    <p class="fzlcrq">
                                        {$vo.title}
                                    </p>
                                </div>
                            </div>
                            {/volist}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    {elseif $pagePart.name == 'contact' /}
    <!-- 联系我们 -->
    {include file='include/contactbox'/}

    {elseif $pagePart.name == 'applicationlist' /}

    <section>
        <div class="yyjuhe-s1">
            <div class="yyjuhe-s1-mid">
                <div class="yyjuhe-s1-top w1600">
                    <p class="products-mid-bt">Applications</p>
                    <p class="mater-s1-title">
                        Explore Our <b>Industry Applications</b>
                    </p>
                    <p class="mater-s1-ertitle">
                        Click on an industry below to learn how EZHONG's advanced machinery can meet the unique
                        challenges of your sector.
                    </p>
                </div>
                <div class="yyjuhe-s1-kuang">
                    <img id="topImage" src="/static/images/solutionlist1.png" alt="ezhong" title="">
                    {volist name='applist' id='vo'}
                    <a class="yyjuhe-s1-k" data-img="/static/images/solutionlist1.png" href="/{$vo.rewrite_url}.html">
                        <img src="/static/images/fc.png" alt="ezhong">
                        {$vo.name}
                    </a>
                    {/volist}
                </div>
            </div>
        </div>
    </section>
    {elseif $pagePart.name == 'Get_in_Touch' /}
    <section>
        <div class="mater-s5">
            <div class="mater-s5-mid w1600">
                <div class="mater-s5-kuang-left">
                    <div class="mater-s5-kuang-left-kuang">
                        <p class="mater-s5-k-title">
                            Get in <b>Touch</b>
                        </p>
                        <p class="mater-s5-k-ertitle">
                            Do you have questions about our products or services, or would you like our advice? Simply
                            reach out via our contact form—we’ll respond as quickly as possible.
                        </p>
                        <div class="mater-s5-lxfs">
                            <div>
                                <img src="/static/images/qqzclxwphone.png" alt=""/>
                            </div>
                            <p>
                                0086-13929593079
                            </p>
                        </div>
                        <div class="mater-s5-lxfs">
                            <div>
                                <img src="/static/images/qqzclxwyouxiang.png" alt=""/>
                            </div>
                            <a class="" href="mailto:">sales@ezhonggroup.com</a>
                        </div>
                    </div>
                </div>
                <div class="mater-s5-kuang-right">
                    {include file="include:contactForm" /}
                </div>
            </div>
        </div>
    </section>
    {else /}
    {$pagePart.content|raw}

    {/if}

    {/volist}


</main>
{include file="include/footer"}
{include file="include/footerFile"}

<!-- solutions的脚本 -->
<script type="text/javascript" src="/static/js/swiper.js"></script>
<script type="text/javascript">
    var materswiper = new Swiper(".materswiper", {
        slidesPerView: 1,
        spaceBetween: 14,
        // centeredSlides: true,
        pagination: {
            el: ".swiper-pagination",
            clickable: true,
        },
        breakpoints: {
            1024: {
                slidesPerView: 2,
                spaceBetween: 32,
            },
            580: {
                slidesPerView: 2,
                spaceBetween: 14,
            },
        },
    });
    var powswiper = new Swiper(".powswiper", {
        slidesPerView: 1,
        spaceBetween: 10,
        pagination: {
            el: ".swiper-pagination",
            clickable: true,
        },
        breakpoints: {
            520: {
                slidesPerView: 2,
                spaceBetween: 28,
            },
        },
    });
</script>
<script type="text/javascript">
    document.addEventListener("DOMContentLoaded", () => {
        const navLinks = document.querySelectorAll(".solutionxq-list-top a");
        const sections = document.querySelectorAll("[id^='section']");
        const offset = window.innerHeight * 0.5;

        let lastActiveId = null;

        // 点击时平滑滚动
        navLinks.forEach(link => {
            link.addEventListener("click", function (e) {
                const href = this.getAttribute("href");
                if (href && href.startsWith("#")) {
                    e.preventDefault();
                    const targetEl = document.querySelector(href);
                    if (targetEl) {
                        targetEl.scrollIntoView({
                            behavior: "smooth",
                            block: "start"
                        });
                    }
                }
            });
        });

        function checkScroll() {
            let activeSectionId = null;

            sections.forEach(section => {
                const rect = section.getBoundingClientRect();
                if (rect.top <= offset && rect.bottom >= 0) {
                    activeSectionId = section.id;
                }
            });

            if (activeSectionId === lastActiveId) return; // 没变则不动，避免频繁滚动

            lastActiveId = activeSectionId;
            // 高亮显示
            navLinks.forEach(link => {
                const href = link.getAttribute("href");
                if (!href || !href.startsWith("#")) return;

                const targetId = href.substring(1);
                const isActive = (targetId === activeSectionId);

                const parentLi = link.closest("li");
                if (parentLi) {
                    parentLi.classList.toggle("active", isActive);
                    if (isActive) {
                        // 只有高亮发生变化时才滚动到中间
                        parentLi.scrollIntoView({
                            behavior: "smooth",
                            inline: "center",
                            block: "nearest"
                        });
                    }
                } else {
                    link.classList.toggle("active", isActive);
                    if (isActive) {
                        link.scrollIntoView({
                            behavior: "smooth",
                            inline: "center",
                            block: "nearest"
                        });
                    }
                }
            });
        }

        // 防抖处理滚动事件
        let isScrolling;
        window.addEventListener("scroll", () => {
            clearTimeout(isScrolling);
            isScrolling = setTimeout(checkScroll, 100);
        });

        // 初始化时先高亮，但不滚动
        function initHighlight() {
            let activeSectionId = null;
            sections.forEach(section => {
                const rect = section.getBoundingClientRect();
                if (rect.top <= offset && rect.bottom >= 0) {
                    activeSectionId = section.id;
                }
            });
            lastActiveId = activeSectionId;

            navLinks.forEach(link => {
                const href = link.getAttribute("href");
                if (!href || !href.startsWith("#")) return;

                const targetId = href.substring(1);
                const isActive = (targetId === activeSectionId);

                const parentLi = link.closest("li");
                if (parentLi) {
                    parentLi.classList.toggle("active", isActive);
                } else {
                    link.classList.toggle("active", isActive);
                }
            });
        }

        initHighlight();
    });
</script>

<!-- about1 -->
<script type="text/javascript">
    document.addEventListener("DOMContentLoaded", function () { //shuzigundong
        const counters = document.querySelectorAll(".counter");

        const animateCount = (el) => {
            const target = +el.getAttribute("data-target");
            const duration = 2000;
            const frameRate = 30;
            const totalSteps = Math.ceil(duration / frameRate);
            let current = 0;
            let step = target / totalSteps;

            const updateCounter = () => {
                current += step;
                if (current < target) {
                    el.textContent = Math.floor(current).toLocaleString();
                    setTimeout(updateCounter, frameRate);
                } else {
                    el.textContent = target.toLocaleString();
                }
            };

            updateCounter();
        };

        const observer = new IntersectionObserver((entries, obs) => {
            entries.forEach(entry => {
                if (entry.isIntersecting) {
                    const el = entry.target;
                    animateCount(el);
                    obs.unobserve(el); // 防止重复触发
                }
            });
        }, {
            threshold: 1.0
        });

        counters.forEach(counter => {
            observer.observe(counter);
        });
    });
</script>

<!-- about2 -->
<script type="text/javascript">
    var fzlcnfswiper = new Swiper(".fzlcnfswiper", {
        spaceBetween: 10,
        slidesPerView: 3,
        freeMode: true,
        watchSlidesProgress: true,
        breakpoints: {
            1440: {
                spaceBetween: 10,
                slidesPerView: 7,
            },
            768: {
                spaceBetween: 10,
                slidesPerView: 5,
            }
        },
    });
    var fzlcxqswiper = new Swiper(".fzlcxqswiper", {
        spaceBetween: 10,
        // navigation: {
        // 	nextEl: ".swiper-button-next",
        // 	prevEl: ".swiper-button-prev",
        // },
        thumbs: {
            swiper: fzlcnfswiper,
        },
    });


</script>

<!-- about3 -->
<script type="text/javascript">
    $(function () {
        if (window.innerWidth <= 991) {
            $(".yyjuhe-s2-fl-k").addClass("active");
        } else {
            $(".yyjuhe-s2-fl-k").hover(function () {
                $(this).addClass("active").siblings().removeClass("active");
            });
        }
    });
</script>

<!-- about4 -->
<script type="text/javascript">
    var powswiper = new Swiper(".powswiper", {
        slidesPerView: 1,
        spaceBetween: 10,
        pagination: {
            el: ".swiper-pagination",
            clickable: true,
        },
        breakpoints: {
            520: {
                slidesPerView: 2,
                spaceBetween: 28,
            },
        },
    });
</script>

<!-- about5 -->
<script type="text/javascript">
    var powswiper = new Swiper(".powswiper", {
        slidesPerView: 1,
        spaceBetween: 10,
        pagination: {
            el: ".swiper-pagination",
            clickable: true,
        },
        breakpoints: {
            520: {
                slidesPerView: 2,
                spaceBetween: 28,
            },
        },
    });
</script>

<!-- 证书脚本 -->
<script type="text/javascript" src="/static/js/baguetteBox.js"></script>

<!-- 应用列表页 -->
<script type="text/javascript">

    $(function () {
        if (window.innerWidth <= 991) {
            $(".yyjuhe-s2-fl-k").addClass("active");
        } else {
            $(".yyjuhe-s2-fl-k").hover(function () {
                $(this).addClass("active").siblings().removeClass("active");
            });
        }
    });
    // shoufengqin
    let canTrigger = true;
    let lastIndex = -1;
    $(".index-s1-div > a").on("mouseenter", function () {
        const currentIndex = $(this).index();

        // 若当前元素相同 or 未解锁，不触发
        if (!canTrigger || currentIndex === lastIndex) return;

        canTrigger = false;
        lastIndex = currentIndex;

        $(this).addClass("active").siblings().removeClass("active");

        setTimeout(() => {
            canTrigger = true;
        }, 500); // 0.5 秒节流
    });


    const topImage = document.getElementById("topImage");
    const items = document.querySelectorAll(".yyjuhe-s1-k");

    // 随机颜色生成函数
    // function getRandomColor() {
    //     const letters = "0123456789ABCDEF"
    //     let color = "#"
    //     for (let i = 0; i < 6; i++) color += letters[Math.floor(Math.random() * 16)];
    //     return color
    // }
    function getRandomColor() {
        const r = Math.floor(Math.random() * 256);
        const g = Math.floor(Math.random() * 256);
        const b = Math.floor(Math.random() * 256);
        return `rgba(${r},${g},${b},0.6)`;
    }

    items.forEach(item => {
        const originalBg = item.style.backgroundColor;

        item.addEventListener("mouseenter", () => {
            const newImg = item.getAttribute("data-img");
            if (newImg) topImage.src = newImg;
            item.style.backgroundColor = getRandomColor();
        });

        item.addEventListener("mouseleave", () => {
            topImage.src = "{$navData.photo}"; // 恢复默认图
            item.style.backgroundColor = originalBg; // 恢复原颜色
        });
    });
</script>
</body>

</html>